<!--
 * @Author: xuhy
 * @Date: 2022-04-25 21:06:22
 * @LastEditTime: 2022-04-25 21:28:52
 * @LastEditors: Please set LastEditors
 * @Description: 数据统计
 * @FilePath: \vue_shop\src\components\report\DataReport.vue
-->
<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item><a href="/">数据统计</a></el-breadcrumb-item>
      <el-breadcrumb-item>数据报表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图 -->
    <el-card>
      <!-- 2.Dom容器 -->
      <div id="main" style="width: 600px; height: 400px"></div>
    </el-card>
  </div>
</template>
<script>
// 1.导入echarts
import * as echarts from 'echarts'
export default {
  data() {
    return {}
  },
  created() {},
  // 此时页面上的元素，已经被渲染完毕了
  async mounted() {
    // 3.基于准备好的dom，初始化echarts实列
    const myChart = echarts.init(document.getElementById('main'))

    await this.$http.get('reports/type/1')

    // 4. 准备数据与配置项
    const option = {
      xAxis: {
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {},
      series: [
        {
          type: 'bar',
          data: [23, 24, 18, 25, 27, 28, 25]
        }
      ]
    }
    // 5.展示数据
    myChart.setOption(option)
  },
  methods: {}
}
</script>
<style lang="less" scoped></style>
